<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SetBatchLines</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>SetBatchLines</h1>

<p>Determines how fast a script will run (affects CPU utilization).</p>

<pre class="Syntax">SetBatchLines, 20ms
SetBatchLines, LineCount</pre>
<h3>Parameters</h3>
<dl>

  <dt>20ms</dt>
  <dd><p>(The 20ms is just an example.) If the value ends in ms, it indicates how often the script should sleep (each sleep is 10 ms long). In the following example, the script will sleep for 10ms every time it has run for 20ms: <code>SetBatchLines, 20ms</code>.</p></dd>

  <dt>LineCount</dt>
  <dd><p>The number of script lines to execute prior to sleeping for 10ms. The value can be as high as 9223372036854775807. Also, this mode is mutually exclusive of the 20ms mode in the previous paragraph; that is, only one of them can be in effect at a time.</p></dd>

</dl>

<h3>Remarks</h3>
<p>Use <code>SetBatchLines -1</code> to never sleep (i.e. have the script run at maximum speed).</p>
<p>The default setting is 10ms, except in versions prior to v1.0.16, which use 10 (lines) instead.</p>
<p>The &quot;ms&quot; method is recommended for scripts whenever speed and cooperation are important. For example, on most systems a setting of 10ms will prevent the script from using any more than 50% of an idle CPU's time. This allows scripts to run quickly while still maintaining a high level of cooperation with CPU sensitive tasks such as games and video capture/playback.</p>
<p>The built-in variable <strong>A_BatchLines</strong> contains the current setting.</p>
<p>The speed of a script can also be impacted by the following commands, depending on the nature of the script: <a href="SetWinDelay.htm">SetWinDelay</a>, <a href="SetControlDelay.htm">SetControlDelay</a>, <a href="SendMode.htm">SendMode</a>, <a href="SetKeyDelay.htm">SetKeyDelay</a>, <a href="SetMouseDelay.htm">SetMouseDelay</a>, and <a href="SetDefaultMouseSpeed.htm">SetDefaultMouseSpeed</a>.</p>
<p>Every newly launched <a href="../misc/Threads.htm">thread</a> (such as a <a href="../Hotkeys.htm">hotkey</a>, <a href="Menu.htm">custom menu item</a>, or <a href="SetTimer.htm">timed</a> subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).</p>
<h3>Related</h3>
<p><a href="SetWinDelay.htm">SetWinDelay</a>, <a href="SetControlDelay.htm">SetControlDelay</a>, <a href="SendMode.htm">SendMode</a>, <a href="SetKeyDelay.htm">SetKeyDelay</a>, <a href="SetMouseDelay.htm">SetMouseDelay</a>, <a href="SetDefaultMouseSpeed.htm">SetDefaultMouseSpeed</a>, <a href="Critical.htm">Critical</a></p>
<h3>Example</h3>
<pre class="NoIndent">SetBatchLines, 10ms 
SetBatchLines, 1000</pre>

</body>
</html>
